
def read_text() -> str:
    with open('./data/lhc.md', mode='r', encoding='utf-8') as file:
        return file.read()
    

def get_chunks() -> list[str]:
    text = read_text()
    chunks = text.split('\n\n')

    result = []
    header = ""
    for chunk in chunks:
        if chunk.startswith('#'):
            header += f'{chunk}\n'
        else:
            result.append(f'{header}{chunk}')
            header = ""

    return result


if __name__ == '__main__':
    chunks = get_chunks()
    for c in chunks:
        print(c)
        print('----------------')